# !/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
===========================
@Time : 2022/8/20 0020 12:43
@Author : 测试开发工程师
@File : demo5.py
@Software: PyCharm
============================
"""

from flask import Flask, render_template
from flask import jsonify

app = Flask(__name__)


# 常见响应类型 - 返回文本
@app.route('/text')
def get_text():
    return '返回文本'


if __name__ == '__main__':
    app.run()


# 返回元组
@app.route('/tuple')
def tuple_res():
    return '霍格沃兹测试学院', 200, {"hogwarts": "xixi"}


if __name__ == '__main__':
    app.run()


# 返回 dict
@app.route('/dict')
def get_dict():
    return {'stauts': 0}


if __name__ == '__main__':
    app.run()


# 返回 json
@app.route('/json')
def get_json():
    # jsonify({'stauts':0})
    return jsonify(status=1, name='xixi')


if __name__ == '__main__':
    app.run()


# 返回 html页面
@app.route('/html')
def get_html():
    return render_template('demo.html')


if __name__ == '__main__':
    app.run()
